@echo off
setlocal enabledelayedexpansion

rem 设置要处理的文件夹路径
set "folderPath=D:\projects\wb\springboot-server\springboot-modules"

rem 设置旧前缀和新前缀
set "oldPrefix=new-x"
set "newPrefix=springboot"

rem 遍历目标文件夹中的所有子文件夹
for /d %%a in ("%folderPath%\%oldPrefix%-*") do (
    rem 获取当前子文件夹名称
    set "oldFolderName=%%~nxa"

    rem 构造新文件夹名称
    set "newFolderName=!oldFolderName:%oldPrefix%=%newPrefix%!"

    rem 获取完整路径
    set "oldFullPath=%%a"
    set "newFullPath=%folderPath%\!newFolderName!"

    rem 执行重命名
    ren "!oldFullPath!" "!newFolderName!"
    echo Renamed "!oldFullPath!" to "!newFullPath!"
)

endlocal
pause
